<template>
  <div class="nickname">
    <van-cell-group>
      <van-field v-model="nickname" />
    </van-cell-group>
    <van-button plain hairline type="primary" @click="gotopersonal"
      >保存</van-button
    >
  </div>
</template>
<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      nickname: "",
    };
  },
  mounted() {
    this.nickname = this.$route.query.nickname;
  },
  methods: {
    gotopersonal() {
      this.$API.user({ nickname: this.nickname }).then((res) => {
        if (res.data.code == 200) {
          Toast.success(res.data.msg);
          this.$router.push('/personal')
        }

        console.log(res);
      });
    },
  },
};
</script>
<style lang="scss">
.nickname {
  min-height: 100vh;
  background: #f0f2f5;
  box-sizing: border-box;
}
</style>